package com.ehaoyao.web;

import com.ehaoyao.produce.RabbitmqProduce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

/**
 * <dl>
 * <dt>OrdereApi</dt>
 * <dd>Description:</dd>
 * <dd>Copyright: Copyright (C) 2006</dd>
 * <dd>CreateDate: 2020/5/12</dd>
 * </dl>
 *
 * @author zhangyp
 */
@RestController
@RequestMapping("/rabbitmq/")
public class RabbitmqApi {

    @Autowired
    private RabbitmqProduce rabbitmqProduce;

    @RequestMapping("/{id}/{price}")
    public String getOrderPay(@PathVariable(value = "id") String id,@PathVariable(value = "price") BigDecimal price){
       for(int i = 1 ;i<=Integer.valueOf(id);i++){
           rabbitmqProduce.sendMsg(String.valueOf(i),price);
       }
        return  id+"提交成功";
    }
}
